package com.name.givename.controller;

import com.github.pagehelper.Page;
import com.name.givename.dto.UserGiveNameDTO;
import com.name.givename.param.GiveNameAddParams;
import com.name.givename.param.VoteNameParams;
import com.name.givename.result.ResultVoUtils;
import com.name.givename.service.GivenameAddService;
import com.name.givename.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * Created by yangtianrui on 18/9/2.
 */
@Api("用户起名")
@RestController("/userGiveName")
public class UserNamedAddController {

    @Autowired private GivenameAddService givenameAddService;

    @ApiOperation("用户起名")
    @PostMapping("/giveName")
    public Result<List<String>> giveName(@RequestBody GiveNameAddParams giveNameAddParams) {
       return givenameAddService.giveNameAdd(giveNameAddParams);
    }


    @ApiOperation("用户投票")
    @PostMapping("/voteName")
    public Result<UserGiveNameDTO> voteName(@RequestBody VoteNameParams voteNameParams) {
        return givenameAddService.voteForNames(voteNameParams);
    }


}
